home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Simulation / PDP-8 Simulator / Source Code / PDPGlobalEqu.p < prev    next >
Encoding:
Text File  |  1992-09-13  |  5.5 KB  |  211 lines  |  [TEXT/KAHL]

  1. /****************************************************************************************
  2. *
  3. *        GlobalEqu.p    - Global Equates for Generic Appshell. Note- this file should
  4. *                        generally be #included in every component file in the project,
  5. *                        which means that editing a value here will force a complete
  6. *                        recompilation of the project. Therefore, define local constants
  7. *                        seperately.
  8. *
  9. ****************************************************************************************/
  10.  
  11.  
  12. #define        standardResID    128            /* base number of resources */
  13. #define        sleepTime        2            /* WNE sleep parameter */
  14.  
  15. #define        NIL                0L
  16.  
  17. #define        appleMenu        0
  18. #define        fileMenu        1
  19. #define        editMenu        2
  20. #define        asmMenu            3
  21. #define        pdpMenu            4
  22.  
  23. #define        NumMenus        5
  24. #define        NumWindows        2
  25.  
  26. #define        ItemAbout        1
  27.  
  28. #define        ItemNew            1
  29. #define        ItemOpen        2
  30. #define        ItemClose        3
  31. /*--------------------------*/
  32. #define        ItemSave        5
  33. #define        ItemSaveAs        6
  34. /*--------------------------*/
  35. #define        ItemPageSetup    8
  36. #define        ItemPrint        9
  37. /*--------------------------*/
  38. #define        ItemQuit        11
  39.  
  40. #define        ItemUndo        1
  41. /*--------------------------*/
  42. #define        ItemCut            3
  43. #define        ItemCopy        4
  44. #define        ItemPaste        5
  45. #define        ItemClear        6
  46. /*--------------------------*/
  47. #define        ItemShowClip    8
  48.  
  49. #define        ItemGo            1
  50. #define        ItemHalt        2
  51. #define        ItemReset        3
  52. #define        ItemSingleStep    4
  53. #define        ItemScrollToPC    5
  54. /*--------------------------*/
  55. #define        ItemPreferences    7
  56. #define        ItemGetInfo        8
  57. /*--------------------------*/
  58. #define        ItemStack        10
  59. #define        ItemShowRuler    11
  60.  
  61. #define        ItemAssemble    1
  62. /*--------------------------*/
  63. #define        ItemToDisk        3
  64. #define        ItemToMemory    4
  65. #define        ItemToBasingstoke    5
  66. /*--------------------------*/
  67. #define        ItemLoadObject    7
  68.  
  69. #define        toDisk        0
  70. #define        toMemory    1
  71.  
  72. #define        GeneralAlertNoCancel    129
  73. #define        GeneralAlertCancel        130
  74. #define        CriticalMemoryAlert        131    
  75.  
  76. typedef unsigned int PDPWord;
  77. typedef    PDPWord *PDPWordPtr;
  78.  
  79. /* note that only the LOWER 12 BITS are used in each instance of a PDPWord. The upper
  80.     bits should be assumed not to exist (as they might not in future) */
  81.     
  82. typedef struct
  83. {
  84.     int            version;            /* version number of this file */
  85.     int            codeOrigin;            /* origin of code for loading */
  86.     long        cwLength;            /* number of words to load */
  87.     long        reserved;            /* reserved */
  88.     PDPWord        firstWord;            /* first code word in file */
  89. }
  90. ObjectHeader, *ObjectPtr;
  91.  
  92. typedef struct
  93. {
  94.     PDPWord        IR;                /* instruction register */
  95.     PDPWord        PC;                /* program counter        */
  96.     PDPWord        EAR;            /* Effective Address Register */
  97.     PDPWord        ACC;            /* Accumulator */
  98.     Byte        CCR;            /* Condition Code register (L is bit 0) */
  99.     Byte        Padding;        /* Pad Byte -reserved for future use */
  100.     Rect        markerLoc;        /* used by graphics to update PC marker */
  101. }
  102. PDPRegisters, *PDPRegPtr, **PDPRegHdl;
  103.  
  104. #define            LBit    1
  105. #define            Link    1
  106. #define            HaltBit    128
  107.  
  108. typedef PDPWord    PDPMemory[4096], *PDPMemPtr, **PDPMemHdl;
  109.  
  110. #define            EditKind        11
  111. #define            ObjectKind        12
  112. #define            SimulatorKind    13
  113.  
  114. typedef struct
  115. {
  116.     int        NumberFormat;        /* format for display of values */
  117.     int        CPUSpeed;            /* ticks between instruction fetches */
  118.     int        DefaultStart;        /* default start vector for this process */
  119.     long    reserved;
  120.     long    cycleTime;            /* tick count of last cycle */
  121.     Byte    EARPointerVis;        /* TRUE if EAR pointer is displayed */
  122.     Byte    MnemonicIR;            /* TRUE if mnemonics displayed in IR */
  123.     Byte    AutoScroll;            /* TRUE if auto scrolling enabled */
  124. }
  125. PrefsRec, *PrefsRecPtr, **PrefsRecHdl;
  126.  
  127. typedef    struct
  128. {
  129.     PDPMemHdl        theMemory;            /* Handle to memory for this process */
  130.     PDPRegHdl        theCPU;                /* Handle to CPU for this process */
  131.     WindowPtr        processOwner;        /* window this process is bound to */ 
  132.     PrefsRecHdl        procPrefs;            /* handle to preferences */
  133.     long            reserved2;            /* future expansion */
  134.     ControlHandle    memScroll;            /* memory scroll bar */
  135.     int                memLocHeight;        /* height of memory cell display */
  136.     int                processID;            /* ID number of this process */
  137. }
  138. ProcessRec, *ProcessRecPtr, **ProcessRecHdl;
  139.  
  140. #define        FastCPU        0
  141. #define        MediumCPU    20
  142. #define        SlowCPU        60
  143. #define        SingleStep    -1
  144. #define        Decimal        0
  145. #define        Octal        1
  146. #define        Hexadecimal    2
  147. #define        Binary        3
  148.  
  149. /* loader and runner error codes */
  150.  
  151. #define        TargetNotSimulator        -177
  152. #define        CodeFileIsNIL            -178
  153. #define        CodeFileIsEmpty            -179
  154. #define        CodeFileTooLong            -180
  155. #define        LoadAddressOutOfRange    -181
  156. #define        TargetHasNoMemory        -182
  157. #define        TargetHasNoProcessor    -183
  158. #define        StartVectorOutOfRange    -184
  159. #define        IllegalInstruction        -185
  160. #define        ProcessHalted            -186
  161. #define        ProcessHasDied            -187
  162. #define        CodeFileBadVersion        -188
  163. #define        CPUAddressingError        -189
  164. #define        MemWriteUpdateRequest    -190
  165.  
  166. /* error codes for the assembler are numbered from -191 onwards */
  167.  
  168. /* opcode equates for basic opcode types */
  169.  
  170. #define        pdpAND        0
  171. #define        pdpTAD        1
  172. #define        pdpISZ        2
  173. #define        pdpDCA        3
  174. #define        pdpJMS        4
  175. #define        pdpJMP        5
  176. #define        pdpIO        6
  177. #define        pdpACC        7
  178.  
  179. /* bitfield equates for group 1 ACC operations */
  180.  
  181. #define        GroupBit    256
  182. #define        pdpCLA        128
  183. #define        pdpCLL        64
  184. #define        pdpCMA        32
  185. #define        pdpCML        16
  186. #define        pdpRBit        8
  187. #define        pdpLBit        4
  188. #define        pdpCBit        2
  189. #define        pdpIAC        1
  190.  
  191. /* bitfield equates for group 2 ACC operations */
  192.  
  193. #define        pdpSMA        64
  194. #define        pdpSZA        32
  195. #define        pdpSNL        16
  196. #define        pdpOSR        4
  197. #define        pdpHLT        2
  198. #define        pdpUnused    1
  199.  
  200. #define        opcodeMask            0x0E00
  201. #define        addressModeMask        0x0180
  202. #define        indirectBit            2
  203. #define        pageBit                1
  204. #define        operandMask            0x007F
  205. #define        topFiveBits            0x0F80
  206. #define        bottom7Bits            0x007F
  207. #define        rotateLeft            0
  208. #define        rotateRight            1
  209.  
  210. #define        memAreaWidth        150
  211. #define        statusBarHeight        26